﻿using System;
using System.Collections.Generic;
using System.Linq;
using AutoR.Models;
using AutoR.Services;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Navigation;
using Prism.Services;
using Xamarin.Forms.Internals;

namespace AutoR.ViewModels.Setting
{
	// Token: 0x020000A5 RID: 165
	public class SystemSettingViewModel : BindableBase, INavigationAware, INavigatedAware, INavigatingAware
	{
		// Token: 0x170000CD RID: 205
		// (get) Token: 0x0600031F RID: 799 RVA: 0x00048ADA File Offset: 0x00046CDA
		private INavigationService NavigationService { get; }

		// Token: 0x170000CE RID: 206
		// (get) Token: 0x06000320 RID: 800 RVA: 0x00048AE2 File Offset: 0x00046CE2
		private IPageDialogService PageDialogService { get; }

		// Token: 0x170000CF RID: 207
		// (get) Token: 0x06000321 RID: 801 RVA: 0x000408F6 File Offset: 0x0003EAF6
		public GameData Game
		{
			get
			{
				return Runtime.Game;
			}
		}

		// Token: 0x170000D0 RID: 208
		// (get) Token: 0x06000322 RID: 802 RVA: 0x00048AEA File Offset: 0x00046CEA
		public DelegateCommand EatTypeCommand { get; }

		// Token: 0x06000323 RID: 803 RVA: 0x00048AF2 File Offset: 0x00046CF2
		public SystemSettingViewModel(INavigationService navigationService, IPageDialogService pageDialogService)
		{
			this.NavigationService = navigationService;
			this.PageDialogService = pageDialogService;
			this.EatTypeCommand = new DelegateCommand(async delegate()
			{
				IEnumerable<string> j = from i in Runtime.Configs.ShipCookbook
				where Runtime.Game.User.LiveCookInfo.cookbook.Contains(i.cid.ToString())
				select i.title;
				string text = await this.PageDialogService.DisplayActionSheetAsync("选择食物", null, null, j.ToArray<string>());
				Runtime.Game.GlobalConfig.EatType = ((text != null) ? j.IndexOf(text) : 0);
			});
		}

		// Token: 0x06000324 RID: 804 RVA: 0x0004067F File Offset: 0x0003E87F
		public void OnNavigatedFrom(INavigationParameters parameters)
		{
		}

		// Token: 0x06000325 RID: 805 RVA: 0x0004067F File Offset: 0x0003E87F
		public void OnNavigatedTo(INavigationParameters parameters)
		{
		}

		// Token: 0x06000326 RID: 806 RVA: 0x0004067F File Offset: 0x0003E87F
		public void OnNavigatingTo(INavigationParameters parameters)
		{
		}
	}
}
